package com.molichuxing.gateway.bff.risk.convertor;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.molichuxing.framework.utils.DateUtil;
import com.molichuxing.gateway.bff.risk.entity.response.BlacklistVo;
import com.molichuxing.gateway.bff.risk.entity.response.CreditRecognitionVo;
import com.molichuxing.services.infrastructure.dto.response.BlacklistDto;
import com.molichuxing.services.infrastructure.dto.response.CreditRecognitionDto;

/**
 * 
 * @author liyg
 * 数据转换类
 * 2019-08-16
 *
 */
public class Convert {
	
	public static BlacklistVo toBlacklistVo(BlacklistDto bizDto) {
		BlacklistVo beanVo = null;
		if (bizDto != null) {
			beanVo = new BlacklistVo();
			BeanUtils.copyProperties(bizDto, beanVo);
			beanVo.setOperationTime(DateUtil.formatDate(bizDto.getOperationTime()));
		}
		return beanVo;
	}
	
	public static CreditRecognitionVo toCreditRecognitionVo(CreditRecognitionDto bizDto) {
		CreditRecognitionVo beanVo = null;
		if (bizDto != null) {
			beanVo = new CreditRecognitionVo();
			BeanUtils.copyProperties(bizDto, beanVo);
		}
		return beanVo;
	}
	
	public static List<BlacklistVo> toBlacklistVo(List<BlacklistDto> bizDtoList) {
		List<BlacklistVo> beanVoList = null;
		if (bizDtoList != null && !bizDtoList.isEmpty()) {
			beanVoList= new ArrayList<>();
			for (BlacklistDto bizDto : bizDtoList) {
				beanVoList.add(toBlacklistVo(bizDto));
			}
		}
		return beanVoList;
	}
	
	
}
